<template>
    <div class="">
        活动页面
    </div>
</template>

<script>
const axios = require('axios')
export default {
    components: {},
    data() {
        return {
            token: '',
            currentPage: 1,						//分页的默认页数
            pagesize: 10,                       //单页条数
            total: 0,						   //总条数
            isCollapse: true
        };
    },
    computed: {},
    watch: {},
    methods: {
        requestgoods(){
            let that = this;
            let data = {current:that.currentPage,size:that.pagesize};
            let updata = JSON.stringify(data)
            axios({
                method: 'post',
                url: '/api/kind/list',
                headers: {
                    'Content-Type': 'application/json',
                    'authorization': `Bearer ${JSON.parse(sessionStorage.getItem('token'))}`,
                },
                data: updata
            })
            .then( resp=> {
                console.log(resp)
                that.selectdata = resp.data.data;
                if(that.classify === undefined){
                    sessionStorage.removeItem("token")
                    location.reload()
                }else{
                    that.selectdata = that.selectdata.filter((item)=> item.level < 3)
                }    
                // console.log(that.selectdata)            
            })
            .catch( err=> {console.log(err)})
        },
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        },

        //拿token
        newtoken(){
            let that = this;
            let axios = require('axios')
			let loguser = JSON.parse(sessionStorage.getItem('updata'))
			let data = {username:loguser.username, password:loguser.password};
			let updata = JSON.stringify(data);
			console.log(updata)
			axios({
				method: 'post',
				url: '/api/getAuthority/manager',
				headers: { 'Content-Type': 'application/json' },
				data: updata
			})
			.then( resp=> {
                that.token = resp.data.data;
				sessionStorage.setItem("token", JSON.stringify(resp.data.data))
                that.requestgoods()
			}).catch( err=> {})
        }
    },
    created() {},
    mounted() {
        let that = this;
        that.newtoken()
    },
    beforeCreate() {},
    beforeMount() {},
    beforeUpdate() {},
    updated() {},
    beforeDestroy() {},
    destroyed() {},
    activated() {},
    }
</script>
<style scoped>

</style>